<?php 
class CBaseFaq extends CBaseEosSingular {

	protected $m_intId;
	protected $m_strAnswer;
	protected $m_strQuestion;
	protected $m_boolIsActive;
	protected $m_boolIsDeleted;
	protected $m_strCreatedOn;
	protected $m_intUserId;
		
	public function __construct() {		
		parent::__construct();
		return true;
	}
	
	/**************************************
	************* SET FUNCTIONS ***********
	**************************************/
	
	public function setId( $intId ) {
		$this->m_intId = $intId;
	}
	
	public function setQuestion( $strQuestion ) {
		$this->m_strQuestion = $strQuestion;
	}
	
	public function setAnswer( $strAnswer ) {
		$this->m_strAnswer = $strAnswer;
	}
	
	public function setUserId( $intUserId ) {
		$this->m_intUserId = $intUserId;
	}
	
	public function setIsDeleted( $boolIsDeleted ) {
		$this->m_boolIsDeleted = $boolIsDeleted;
	}
	
	public function setIsActive( $boolIsActive ) {
		$this->m_boolIsActive = $boolIsActive;
	}
	
	public function setCreatedOn( $strCreatedOn  ) {
		$this->m_strCreatedOn = $strCreatedOn ;
	}
	
	/**************************************
	************* GET FUNCTIONS ***********
	**************************************/
	
	public function getId() {
		return $this->m_intId;
	}
	

	public function getQuestion() {
		return $this->m_strQuestion;
	}
	
	public function getAnswer() {
		return $this->m_strAnswer;
	}
	
	public function getUserId() {
		return $this->m_intUserId;
	}
	
	public function getIsActive() {
		return $this->m_boolIsActive;
	}
	
	public function getIsDeleted() {
		return $this->m_boolIsDeleted;
	}
	
	public function getCreatedOn() {
		return $this->m_strCreatedOn;
	}
	
	
	/**************************************
	************* DATABASE FUNCTIONS ***********
	**************************************/
	
	public function insert( $objDatabase ) {
		$strSql  = ' INSERT INTO `faqs` (`user_id`,`question`, `answer`,`is_active`, `is_deleted`, `created_on`)';   
		$strSql .= ' VALUES ( \'' . $this->getUserId() . '\',';
		$strSql .= ' \'' . $this->getQuestion() . '\',';
		$strSql .= ' \'' . $this->getAnswer() . '\',';
		$strSql .= ' \'' . $this->getIsActive() . '\',';
		$strSql .= ' \'' . $this->getIsDeleted() . '\',';
		$strSql .= ' \'' . $this->getCreatedOn() . '\');';
    	return parent::insertRecord( $strSql, $objDatabase );
	}
	
	public function update( $objDatabase ) {
		$strSql  = ' UPDATE `faqs` SET ';
		$strSql .= ' `user_id` = \'' . $this->getUserId() . '\',';
		$strSql .= ' `question` =  \'' . $this->getQuestion() . '\',';
		$strSql .= ' `answer` = \'' . $this->getAnswer() . '\',';
		$strSql .= ' `is_active` = \'' . $this->getIsActive() . '\'';
		$strSql .= ' WHERE `id` = \'' . $this->getId() . '\';';
	
		return parent::updateRecord( $strSql, $objDatabase );
	}
	
	public function delete( $objDatabase ) {
	
		$strSql = ' DELETE FROM `faqs` WHERE `id` = ' . $this->getId();
		return parent::deleteRecord( $strSql, $objDatabase );
	}
	
}

?>